package com.jgy;

import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jgy.entity.SpaceUser;
import com.jgy.entity.User;
import com.jgy.utils.TimeUtil;
import lombok.Data;
import org.apache.commons.collections4.SplitMapUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.openxmlformats.schemas.drawingml.x2006.main.STPitchFamily;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.transaction.annotation.Transactional;

import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author 姜光远
 * @date 2023/3/16 16:38
 */
public class test {

    @Test
    public void test() throws InterruptedException {
        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date old = new Date();
        System.out.println(sp.format(old));
        Thread.sleep(10000);
        Date now = new Date();
        System.out.println(sp.format(now));
       long time = now.getTime() - old.getTime();

        TimeUnit times = TimeUnit.SECONDS;
        long convert = times.convert(time, TimeUnit.MILLISECONDS);
        System.out.println(convert>10);
        System.out.println(convert);
    }
    @Test
    public void test1(){
            int i = 50;
            int j = 10;
        String percent = percent(i, j);
        System.out.println(percent);
    }
    @Test
    public void test2(){
        List<String> list = new ArrayList<>();
        List<String> list2 = new ArrayList<>();
        list.add("aa");
        list.add("bb");
        list.add("aa");
        list2.addAll(list);
        list2.add("asd");
        list2.add("ard");
        list2.add("qqd");
        List<String> aa = list.stream().filter(data -> {
            AtomicBoolean steate = new AtomicBoolean(false);
            list2.forEach(datas->{
                if (datas.equals(data)){
                   steate.set(true);
                }
            });
            return steate.get();
        }).collect(Collectors.toList());
        System.out.println(aa);
    }

    @Test
    public void test3(){
        String data = "60.0";
       if (Double.parseDouble(data) > 15){
           System.out.println(111);
       }
    }



    @Test
    public void test5(){

        double sum = 456.6115d;
        BigDecimal bigDecimal = BigDecimal.valueOf(sum / 60);
        double v = sum / 60 ;
        System.out.println(bigDecimal);
    }

    @Test
    public void test7(){

        double a = 6.06d;
        double b = 3.02d;

        double k = a/b +15d;
        System.out.println(k);
    }



    public String percent(int x, int y) {
        String percent = "";
        double xx = x * 100.0;
        double yy = y * 100.0;
        double zz = xx / yy;
        //DecimalFormat df = new DecimalFormat("##.00%");
        DecimalFormat df = new DecimalFormat("0.00");
        if (Math.abs(zz) < 0.000000000001) {
            percent = "0.00";
        } else {
            percent = df.format(zz);
        }
        return percent;
    }

    public static boolean checkString(String str) {
        String pattern = "^(AUTO_1_|AUTO_50_|AUTO_61_|AUTO_62_|AUTO_63_|AUTO_2_).*";
        return  Pattern.compile(pattern).matcher(str).matches();

    }

    @Test
    public void test9(){

        boolean checkString = checkString("AUTO_67_as");
        System.out.println(checkString);


    }

    @Test
    public void test8(){

        LocalDateTime dateTime = LocalDateTime.now();

        String formattedDateTime = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.println(formattedDateTime);

    }

    @Test
    public void test10(){

        // 将字符串类型的00:05转换为LocalTime类型
        String timeStr = "00:05";
        LocalTime timeObj = LocalTime.parse(timeStr);
        // 增加五分钟
        LocalTime newTimeObj = timeObj.plusMinutes(5);
        // 将结果转换为字符串类型
        String newTimeStr = newTimeObj.toString();
        System.out.println(newTimeStr); // 输出：00:10

    }
    @Test
    public void test11(){
        List<User> userList = new ArrayList<>();
        List<SpaceUser> spaceUserList = new ArrayList<>();
        SpaceUser spaceUser = new SpaceUser("6", "super", "$2a$10$0pt7WlfTbnPDTcWtp/.2Mu5CTXvohnNQhR628qq4RoKSc0dGAdEgm", null, "33121", null, "超级管理员", "https://light-shopping.oss-cn-beijing.aliyuncs.com/2022/01/10/213473ab-e282-487b-a12e-adc8b3cc684d1b9c635cd7a8a70d.jpg", null, "1013", null, "1", null, null, null, "17576", null, null);
        SpaceUser spaceUser1 = new SpaceUser("5", "325", "$2a$10$0pt7WlfTbnPDTcWtp/.2Mu5CTXvohnNQhR628qq4RoKSc0dGAdEgm", null, "44", null, "管理员", "https://light-shopping.oss-cn-beijing.aliyuncs.com/2022/01/10/213473ab-e282-487b-a12e-adc8b3cc684d1b9c635cd7a8a70d.jpg", null, "425", null, "0", null, "1456", null, "75773", null, null);
        SpaceUser spaceUser2 = new SpaceUser("4", "hjg", "$2a$10$0pt7WlfTbnPDTcWtp/.2Mu5CTXvohnNQhR628qq4RoKSc0dGAdEgm", null, "22", null, "stu", "https://light-shopping.oss-cn-beijing.aliyuncs.com/2022/01/10/213473ab-e282-487b-a12e-adc8b3cc684d1b9c635cd7a8a70d.jpg", null, "111", null, "0", null, "null", null, "2333", null, null);
        SpaceUser spaceUser3 = new SpaceUser("3", "lij", "$2a$10$0pt7WlfTbnPDTcWtp/.2Mu5CTXvohnNQhR628qq4RoKSc0dGAdEgm", null, "1111", null, "admin", "https://light-shopping.oss-cn-beijing.aliyuncs.com/2022/01/10/213473ab-e282-487b-a12e-adc8b3cc684d1b9c635cd7a8a70d.jpg", null, "222", null, "1", null, null, null, "4444", null, null);
        spaceUserList.add(spaceUser);
        spaceUserList.add(spaceUser1);
        spaceUserList.add(spaceUser2);
        spaceUserList.add(spaceUser3);


        BeanWrapper space = new BeanWrapperImpl();
        BeanWrapper user = new BeanWrapperImpl();


        spaceUserList.forEach(data ->{
            User user1 = new User();
            user.setPropertyValue("address",space.getPropertyValue("wxUnionid"));
            BeanUtils.copyProperties(data,user1);

            userList.add(user1);
        });

        System.out.println(userList.size());
        System.out.println(userList);
    }
    @Test
    public void test6() throws IOException {
        Workbook workbook = new XSSFWorkbook();
        Sheet sheet = workbook.createSheet("测试表格");

        //设置字体
        Font headerFont = workbook.createFont();
        headerFont.setBold(true);
        headerFont.setFontHeightInPoints((short) 14);
        headerFont.setColor(IndexedColors.RED.getIndex());
        CellStyle headerCellStyle = workbook.createCellStyle();
        headerCellStyle.setFont(headerFont);
        headerCellStyle.setAlignment(HorizontalAlignment.CENTER);

        //创建表头行
        Row headerRow = sheet.createRow(0);

        //创建表头单元格
        Cell headerCell = headerRow.createCell(0);
        headerCell.setCellValue("姓名");
        headerCell.setCellStyle(headerCellStyle);

        headerCell = headerRow.createCell(1);
        headerCell.setCellValue("年龄");
        headerCell.setCellStyle(headerCellStyle);

        headerCell = headerRow.createCell(2);
        headerCell.setCellValue("性别");
        headerCell.setCellStyle(headerCellStyle);

        //创建数据行
        Row dataRow = sheet.createRow(1);

        //创建数据列
        Cell dataCell = dataRow.createCell(0);
        dataCell.setCellValue("张三");

        dataCell = dataRow.createCell(1);
        dataCell.setCellValue(18);

        dataCell = dataRow.createCell(2);
        dataCell.setCellValue("男");

        //使用try-with-resources来关闭文件输出流
        try (FileOutputStream outputStream = new FileOutputStream("test.xlsx")) {
            workbook.write(outputStream);
        }

    }

    @Test
    public void test12(){
        String plant ="1111300037";
        String gen = "110413000000000049";
        System.out.println(plant.length()+"--------"+gen.length());
    }

    @Test
    public void test13(){
        Map<String, List<User>> hisPlclogWinds = new HashMap<>();
        User user = new User();
        user.setId(123);
        List<User> list = new ArrayList<>();
        list.add(user);
        hisPlclogWinds.put("123",list);
        List<User> list1 = hisPlclogWinds.get("123");
        List<User> list2 = hisPlclogWinds.get("456");
        List<User> collect = list2.stream().filter(data -> data.getAge() != null).collect(Collectors.toList());
        System.out.println(collect);
    }

    @Test
    public void test14(){
        Map<String, Integer> map = new HashMap<>();
        map.put("A", 1);
        map.put("B", 2);
        map.put("C", 3);

        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
        for (Map.Entry<String, Integer> entry : entrySet) {
            String key = entry.getKey();
            Integer value = entry.getValue();
            System.out.println("Key: " + key + ", Value: " + value);
        }
    }
    @Test
    public void test15(){
    List<String> plantName = new ArrayList<>();
    plantName.add("10号发电机");
        plantName.add("11号发电机");
        plantName.add("10号发电机");
        plantName.add("1号发电机");

        Set<String> set = new HashSet<>(plantName);
        String distinctList =String.join(",",set);
        System.out.println(distinctList);
    }

    @Test
    public void test16(){
        String a = "sadfffs";
        String b = "%";
        String c = "_";
        char c1 = c.charAt(0);
        String.valueOf(c1).equals("_");
        System.out.println("_".equals(String.valueOf(c1)));
    }

    @Test
    public void test17(){
        List<SpaceUser> spaceUserList = new ArrayList<>();
        List<SpaceUser> collect = spaceUserList.stream().filter(data -> {
            if (data.getId() != null) {
                return true;
            }
            return false;
        }).collect(Collectors.toList());
        System.out.println(collect);
    }

    @Test
    public void test18(){
        List<String> spaceUserList = new ArrayList<>();
        spaceUserList.add("022154610");
        spaceUserList.add("75758633");
        spaceUserList.add("428828285");
        spaceUserList.add(null);
        String data = null;

        if (spaceUserList.contains(data)){
            System.out.println(1111);
        }

    }

    @Test
    public void test19(){
        String time1 = "2023-06-15 10:30:00";
        String time2 = "2023-06-14 11:00:00";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            Date date1 = sdf.parse(time1);
            Date date2 = sdf.parse(time2);

            if (date1.compareTo(date2) < 0) {
                System.out.println(time1 + " 在 " + time2 + " 之前");
            } else if (date1.compareTo(date2) > 0) {
                System.out.println(time1 + " 在 " + time2 + " 之后");
            } else {
                System.out.println(time1 + " 和 " + time2 + " 相同");
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }


    @Test
    public void test20(){

        List<String> collectx = Arrays.asList("河北省调","沧州地调","邢台地调","保定地调","邯郸地调","石家庄地调","衡水地调","雄安地调");
        List<String> list = new ArrayList<>();
        collectx.forEach(data->{
            if (data.equals("河北省调")){
                data = "省调";
            }else {
              data =  data.replace("地调","");
            }
            list.add(data);
        });

        System.out.println(list);
    }

    @Test
    public void test21(){

        List<String> asList1 = Arrays.asList("变电站", "开关站", "配电室");
        List<String> asList2 = Arrays.asList("变电站","开关站", "配电室");

        // 创建一个新的列表，元素为两个列表不同的元素
        List<String> differentElements = new ArrayList<>(asList1);
        differentElements.removeAll(asList2);

        // 输出不同的元素
        for (String element : differentElements) {
            System.out.println(element);
        }
    }
    @Test
    public void test22(){

        List<String> asList1 = Arrays.asList("变电站", "开关站", "配电室");
        List<String> asList2 = Arrays.asList("变电站","开关站", "配电室");

        // 创建一个新的列表，元素为两个列表不同的元素
        List<String> differentElements = new ArrayList<>(asList1);
        differentElements.removeAll(asList2);

        // 输出不同的元素
        for (String element : differentElements) {
            System.out.println(element);
        }

        List<List<String>> lists = this.batchList(asList1, 2);

        System.out.println(lists);
    }


    public  <T> List<List<T>> batchList(List<T> inputList, int batchSize) {
        List<List<T>> batches = new ArrayList<>();

        for (int i = 0; i < inputList.size(); i += batchSize) {
            int end = Math.min(i + batchSize, inputList.size());
            List<T> batch = inputList.subList(i, end);
            batches.add(batch);
        }
        return batches;
    }
    class A {
        private synchronized void method1() throws InterruptedException {
            Thread.sleep(1000);
            method2();
        }
        private synchronized void method2() throws InterruptedException {
            Thread.sleep(1000);

        }
    }
    @Test
    public void test23(){
        double value = 0; // 假设要格式化的值为 0.123456789

        DecimalFormat decimalFormat = new DecimalFormat("0.0000");
        String formattedValue = decimalFormat.format(value);
        double v = Double.parseDouble("0.0310");
        System.out.println(v); // 输出：0.1235
    }

    @Test
    public void test24(){

        final AtomicInteger atomicInteger = new AtomicInteger();

        final int i = 100;

        Semaphore semaphore1 = new Semaphore(1);

        Semaphore semaphore2 = new Semaphore(0);


        //开始多线程
        CompletableFuture.runAsync(() ->{
            while (atomicInteger.get() < i){
                try {
                    semaphore1.acquire();
                    atomicInteger.incrementAndGet();
                    if (atomicInteger.get()>i){
                        return;
                    }
                    System.out.println("A------------"+atomicInteger.get());
                    semaphore2.release();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        CompletableFuture.runAsync(() ->{
            while (atomicInteger.get() < i){
                try {
                    semaphore2.acquire();
                    atomicInteger.incrementAndGet();
                    if (atomicInteger.get()>i){
                        return;
                    }
                    System.out.println("B--------------"+atomicInteger.get());
                    semaphore1.release();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).join();

    }

    @Test
    public void test25(){
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            list.add(String.valueOf(i));
        }
        PageInfo<String> stringPageInfo = pageLimit(list, 3, 30);
        System.out.println(stringPageInfo);
    }

    public <T> PageInfo<T> pageLimit(List<T> list, int pageNum, int pageSize){
        // 数据总数
        int total = list.size();
        // 使用stream的skip方法跳过 实现
        List<T> pageList = list .stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
        int pageSum = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
        PageInfo<T> pageInfo = new PageInfo<>(pageList);
        pageInfo.setPageNum(pageNum);
        pageInfo.setPageSize(pageSize);
        pageInfo.setPages(pageSum);
        pageInfo.setTotal(total);
        return pageInfo;
    }
    @Test
    public void test26(){
     String a = "2023-04-07";
        System.out.println(a.substring(5,7));
    }

    @Test
    public void  test27(){
        List<String> dayListInMonth = TimeUtil.getDayListInMonth("2023-02");
        System.out.println(dayListInMonth);

        List<String> monthListInYear = TimeUtil.getMonthListInYear("2023");
        System.out.println(monthListInYear);

        LocalDate mwhDate = LocalDate.now();
        LocalDate startDate = mwhDate.with(TemporalAdjusters.firstDayOfYear());
        System.out.println(startDate);
    }

    @Test
    public void  test28(){
        List<String> dayListInMonth = TimeUtil.getDayListInMonth("2023-02");
        System.out.println(dayListInMonth);

        List<String> monthListInYear = TimeUtil.getMonthListInYear("2023");
        System.out.println(monthListInYear);

        LocalDate mwhDate = LocalDate.now();
        LocalDate startDate = mwhDate.with(TemporalAdjusters.firstDayOfYear());
        System.out.println(startDate);
    }


    @Test
    public void  test29(){

        


        String dateString = "Fri Dec 01 2023 00:00:00 GMT 0800 (中国标准时间)";

        // 创建输入日期字符串的解析格式
        SimpleDateFormat inputFormat = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT' Z (z)");

        try {
            // 解析输入字符串为Date对象
            Date date = inputFormat.parse(dateString);

            // 创建输出日期的格式
            SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM");

            // 转换为指定格式的字符串
            String formattedDate = outputFormat.format(date);

            System.out.println(formattedDate); // 打印输出结果
        } catch (Exception e) {
            e.printStackTrace();
        }
    }





    @Test
    public void  test31(){




        String startDate = "2023-02-02";
        String endDate = "2023-03-31";


        TimeRangeInterval interval = getInterval(startDate, endDate);


        System.out.println("包含的月份：" + interval);
    }

    /**
     * 获取有效月份及时间段
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @return res
     */
    private TimeRangeInterval getInterval(String startDate, String endDate) {
        TimeRangeInterval interval = new TimeRangeInterval();

        //获取有效月份list
        List<String> includedMonths = getIncludedMonths(startDate, endDate);
        interval.setMonth(includedMonths);

        //获取时间段
        getTimeCheck(interval, startDate, endDate,includedMonths);

        return interval;
    }

    /**
     * 获取时间段
     * @param interval 返回对象
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @param includedMonths  有效月份list
     */
    private void getTimeCheck(TimeRangeInterval interval, String startDate, String endDate,List<String> includedMonths) {
        String start = startDate.substring(8, 10);
        String end = endDate.substring(8,10);
        String monthDays = getMonthDays(endDate);

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        if (CollUtil.isEmpty(includedMonths)){
            interval.setStartTimeP(startDate);
            interval.setEndTimeP(endDate);
        }else {
            if (!"01".equals(start)){
                // 将字符串解析为LocalDate对象
                LocalDate date = LocalDate.parse(startDate, formatter);
                // 获取该月份的第一天
                LocalDate firstDayOfMonth = date.withDayOfMonth(1);
                String firstDayOfMonthString = firstDayOfMonth.format(formatter);
                // 获取该月份的最后一天
                LocalDate lastDayOfMonth = date.withDayOfMonth(date.lengthOfMonth());
                String lastDayOfMonthString = lastDayOfMonth.format(formatter);
                interval.setStartTimeP(startDate);

                interval.setEndTimeP(lastDayOfMonthString);
            }
            if (!monthDays.equals(end)){
                // 将字符串解析为LocalDate对象
                LocalDate date = LocalDate.parse(endDate, formatter);
                // 获取该月份的第一天
                LocalDate firstDayOfMonth = date.withDayOfMonth(1);
                String firstDayOfMonthString = firstDayOfMonth.format(formatter);

                interval.setStartTimeT(firstDayOfMonthString);

                interval.setEndTimeT(endDate);
            }
        }
    }

    /**
     * 获取有效月份
     * @param startDateStr 开始时间
     * @param endDateStr 结束时间
     * @return 有效月份list
     */
    public  List<String> getIncludedMonths(String startDateStr, String endDateStr) {
        List<String> includedMonths = new ArrayList<>();

        //获取次月有多少天
        String monthDays = getMonthDays(endDateStr);

        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date startDate = sdf.parse(startDateStr);
            Date endDate = sdf.parse(endDateStr);

            Calendar calendar = Calendar.getInstance();
            calendar.setTime(startDate);

            while (!calendar.getTime().after(endDate)) {
                String currentMonth = new SimpleDateFormat("yyyy-MM").format(calendar.getTime());
                if (!includedMonths.contains(currentMonth)) {
                    includedMonths.add(currentMonth);
                }
                calendar.add(Calendar.MONTH, 1);
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }

        //开始时间不是一号，去掉这个月
        if (!"01".equals(startDateStr.substring(8,10)) && CollUtil.isNotEmpty(includedMonths)){

            includedMonths.remove(0);
        }
        //结束时间不是这个月最后一天，去掉这个月
        if (!monthDays.equals(endDateStr.substring(8,10)) && CollUtil.isNotEmpty(includedMonths)){
            includedMonths.remove(includedMonths.size()-1);
        }
        return includedMonths;
    }





    //public static List<String> extractMonthRange(String startDateStr, String endDateStr) {
    //    List<String> result = new ArrayList<>();
    //
    //    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    //    LocalDate startDate = LocalDate.parse(startDateStr, formatter);
    //    LocalDate startOneDay = startDate.withDayOfMonth(1);
    //    LocalDate endDate = LocalDate.parse(endDateStr, formatter);
    //
    //    while (!startDate.isAfter(endDate)) {
    //        result.add(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")));
    //        startDate = startDate.plusMonths(1);
    //    }
    //
    //    if (!startOneDay.isEqual(startDate)){
    //        result.remove(0);
    //    }
    //
    //    return result;
    //}




    public String judgeTwoMonth(String startDay,String endDay){
        String startTimeTest = startDay.substring(0,7)+"-01";
        Temporal temporal1 = LocalDate.parse(startTimeTest);
        String endTimeTest = endDay.substring(0,7)+"-01";
        Temporal temporal2 = LocalDate.parse(endTimeTest);
        // 方法返回为相差月份
        long betweenMonth = ChronoUnit.MONTHS.between(temporal1, temporal2);
        Temporal temporalStart = LocalDate.parse(startDay);
        Temporal temporalEnd = LocalDate.parse(endDay);
        long betweenDay=ChronoUnit.DAYS.between(temporalStart,temporalEnd);
        String betweenDay1= String.valueOf(betweenDay+1);
        if(startDay.substring(5, 7).equals(endDay.substring(5, 7))){
            if(Objects.equals(getMonthDays(startDay), betweenDay1)){
                return "onOneMonth";//是完整一个月
            }else {

                return "notOnOneMonth";//不是完整一个月
            }
        }else if(betweenMonth==1){
            String startNumber=getMonthDays(startDay);
            String endNumber=getMonthDays(endDay);
            String between= String.valueOf(Integer.parseInt(startNumber)+Integer.parseInt(endNumber));
            if(between.equals(betweenDay1)){
                return "onTwoMonth";//是完整两个月
            }else if(startDay.substring(8, 10).equals("01")){
                return "oneMonthNoTwoMonth";//第一个月完整，第二个月不完整
            }else if(endDay.substring(8, 10).equals(getMonthDays(endDay))){
                return "noOneMonthTwoMonth";//第一个月不完整，第二个月完整
            }else {
                return "noTwoMonth";//两个月都不完整
            }
        }else {
            //如果相隔2个月以及以上
            if(startDay.substring(8, 10).equals("01") && endDay.substring(8, 10).equals(getMonthDays(endDay))){
                return "2month";
            }else if(startDay.substring(8, 10).equals("01")){
                return "2monthOneMonth";//第一个月完整，第二个月不完整
            }else if(endDay.substring(8, 10).equals(getMonthDays(endDay))){
                return "2monthTwoMonth";//第一个月不完整，第二个月完整
            }else {
                return "notTwoMonth";//两个月都不完整
            }
        }
    }
    
    
    


    public String getMonthDays(String yearMonth) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        Calendar calendar = Calendar.getInstance();
        try {
            calendar.setTime(sdf.parse(yearMonth));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        String maxDay= String.valueOf(calendar.getActualMaximum(Calendar.DATE));
        return maxDay;
    }



}
